

package vistas;

import controladores.CCategoria;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.event.ActionListener;



public class VCategoria extends javax.swing.JFrame {
    
    
	private CCategoria control;
	
	public VCategoria(CCategoria ctrl) {
		super();
		initComponents();
		control= ctrl;
	}

    public void addListener(ActionListener escuchador){
        btnSalir.addActionListener(escuchador);
        btnRegistrar.addActionListener(escuchador);
        btnCancelar.addActionListener(escuchador);
  
        btnSalir.setActionCommand("Salir");
        btnRegistrar.setActionCommand("Registrar");
        btnCancelar.setActionCommand("Cancelar");
      
    
    }
    
    public void reiniciar(){
        txtDescripcion.setText("");
    }

    public JTextField getTxtDescripcion() {
        return txtDescripcion;
    }
    
    public void setCodigo(String codigo){
    	txtCodigo.setText(codigo);
    }
    
    public JTextField getTxtCodigo(){
    	return txtCodigo;
    }




    
    @SuppressWarnings("unchecked")
    
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        btnSalir = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        btnRegistrar = new javax.swing.JButton();
       
       txtDescripcion = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Registro de Categorias");
        getContentPane().setLayout(null);

        jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel2.setLayout(null);

        btnSalir.setFont(new java.awt.Font("Arial", 1, 15)); // NOI18N
        btnSalir.setText("Salir");
        jPanel2.add(btnSalir);
        btnSalir.setBounds(270, 20, 120, 40);

        btnCancelar.setFont(new java.awt.Font("Arial", 1, 15)); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.setPreferredSize(new java.awt.Dimension(80, 30));
        jPanel2.add(btnCancelar);
        btnCancelar.setBounds(140, 20, 120, 40);

        btnRegistrar.setFont(new java.awt.Font("Arial", 1, 15)); // NOI18N
        btnRegistrar.setText("Registrar");
        btnRegistrar.setPreferredSize(new java.awt.Dimension(80, 30));
        jPanel2.add(btnRegistrar);
        btnRegistrar.setBounds(10, 20, 120, 40);

        getContentPane().add(jPanel2);
        jPanel2.setBounds(48, 198, 400, 80);
        jPanel2.setForeground(new java.awt.Color(144,238,144));
        jPanel2.setBackground(new java.awt.Color(168,217,237));
        getContentPane().add(txtDescripcion);
        txtDescripcion.setBounds(191, 126, 110, 25);

        jLabel1.setFont(new java.awt.Font("Arial", 1, 15)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(0,0,0));
        jLabel1.setText("Codigo:");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(66, 30, 120, 30);
        jLabel1.setBackground(new java.awt.Color(0,0,0));
        {
        	jLabel2 = new JLabel();
        	getContentPane().add(jLabel2);
        	jLabel2.setText("Descripcion:");
        	jLabel2.setFont(new java.awt.Font("Arial",1,15));
        	jLabel2.setForeground(new java.awt.Color(0,0,0));
        	jLabel2.setBounds(59, 122, 120, 30);
        	jLabel2.setBackground(new java.awt.Color(0,0,0));
        }
        {
        	txtCodigo = new JTextField();
        	getContentPane().add(txtCodigo);
        	txtCodigo.setText("");
        	txtCodigo.setBounds(193, 32, 110, 28);
        	txtCodigo.setEditable(false);
        }

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        this.setBounds(0, 0, 515, 344);
        getContentPane().setForeground(new java.awt.Color(173,216,230));
        getContentPane().setBackground(new java.awt.Color(230,238,250));
    }


    
    private javax.swing.JButton btnCancelar;
    private JTextField txtCodigo;
    private JLabel jLabel2;
    private javax.swing.JButton btnRegistrar;
    private javax.swing.JButton btnSalir;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JTextField txtDescripcion;
    

}
